package ch1.base.saveend;

public class EndRunable {

    //定义一个线程
    private static class UseRunbale implements Runnable{
        @Override
        public void run() {
            while (!Thread.currentThread().isInterrupted()){
                System.out.println(Thread.currentThread().getName() + " is running");
            }
            System.out.println(Thread.currentThread().getName() + "interrupt flat " + Thread.currentThread().isInterrupted());
        }
    }



    public static void main(String[] args) throws InterruptedException {
        UseRunbale useRunbale = new UseRunbale();
        Thread endThread = new Thread(useRunbale);
        endThread.start();

        Thread.sleep(20);
        endThread.interrupt();
    }
}